package com.example.scenictourback.dto;

import com.example.scenictourback.entity.ScenicSpot;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
public class ScenicSpotDTO {
    
    private Integer id;
    private Integer scenicAreaId;
    private String scenicAreaName;
    private String name;
    private String description;
    
    public static ScenicSpotDTO fromEntity(ScenicSpot entity) {
        ScenicSpotDTO dto = new ScenicSpotDTO();
        dto.setId(entity.getId());
        dto.setScenicAreaId(entity.getScenicArea().getId());
        dto.setScenicAreaName(entity.getScenicArea().getName());
        dto.setName(entity.getName());
        dto.setDescription(entity.getDescription());
        return dto;
    }
    
    public static List<ScenicSpotDTO> fromEntities(List<ScenicSpot> entities) {
        return entities.stream()
                .map(ScenicSpotDTO::fromEntity)
                .collect(Collectors.toList());
    }
} 